<template>
	<view class="content font_family">
		<view class="item" v-for="(item,index) in list" :key="index">
			<view class="tag">满减券</view>
			<view class="top f_z_b">
				<view class="left f_d f_z_b">
					<view class="q_title">
						{{item.coupon_title}}
					</view>
					<view class="time">
						有效期{{item.draw_range}}
					</view>
				</view>
				<view class="right f_j">
					<view class="price">
						<view class="num">
							<text style="font-size: 26rpx;">￥</text>
							<text>{{item.coupon_used_amount}}</text>
						</view>
						<view class="tip">
							满{{item.coupon_with_amount}}元可用
						</view>
					</view>
				</view>
			</view>
			<view class="bottom">
				{{item.coupon_remarks}}
			</view>
			<view class="go_use f">
				<view class="btn" @click="go_use">
					去使用
				</view>
			</view>
		</view>
		<u-empty v-if="list.length==0" text='没有优惠券哦~' icon="/static/public/kong.png">
		</u-empty>
	</view>
</template>

<script>
	import { list } from '@/api/user.js'
	export default {
		data() {
			return {
				list: [],
			}
		},
		onLoad() {
			this.get_list()
		},
		methods: {
			get_list() {
				list().then(res => {
					if (res.code == 1) {
						this.list = res.data
					}
				})
			},
			go_use() {
				uni.switchTab({
					url: '/pages/type/type'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		// background-color: #FFFFFF;
		padding: 30rpx;

		.item {
			position: relative;
			margin-top: 30rpx;
			padding: 30rpx;
			padding-top: 50rpx;
			background: #FFFFFF;
			border-radius: 24rpx;

			.tag {
				position: absolute;
				top: 0;
				left: 0;
				background: #FE654D;
				border-radius: 24rpx 0rpx 24rpx 0rpx;
				font-weight: 400;
				font-size: 24rpx;
				color: #FFE9E6;
				padding: 7rpx 23rpx;
			}

			.top {
				padding-bottom: 23rpx;
				border-bottom: 2rpx dashed #D2D2D2;

				.left {
					.q_title {
						font-weight: 600;
						font-size: 34rpx;
						color: #111111;
					}

					.time {
						font-weight: 400;
						font-size: 24rpx;
						color: #585858;
					}
				}

				.right {
					.price {
						.num {
							font-weight: 400;
							font-size: 40rpx;
							color: #FF6554;
						}

						.tip {
							font-weight: 400;
							font-size: 24rpx;
							color: #F4705D;
						}
					}

					.gx {
						width: 38rpx;
						height: 38rpx;
						margin-left: 20rpx;
					}
				}
			}

			.bottom {
				margin-top: 30rpx;
				font-weight: 400;
				font-size: 22rpx;
				color: #959595;
			}

			.go_use {
				justify-content: flex-end;

				.btn {
					// margin-left: 15rpx;
					padding: 12rpx 30rpx;
					font-weight: 400;
					font-size: 29rpx;
					color: #FFFFFF;
					background: linear-gradient(267deg, #FB4034 0%, #FE6A3F 100%);
					border-radius: 829rpx 829rpx 829rpx 829rpx;
				}
			}
		}
	}
</style>